home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / s342q07.lha / liblog2.c < prev    next >
C/C++ Source or Header  |  1994-10-08  |  2KB  |  75 lines

  1. /*
  2. *                liblog2.c
  3. *
  4. * Citadel log code for the library
  5. */
  6. /*
  7. *                history
  8. *
  9. * 89Feb05 HAW  File created.
  10. */
  11. #include "ctdl.h"
  12. /*
  13. *                Contents
  14. *
  15. * findPerson()         Loads a log record.
  16. * PersonExists()        See if given name is valid for mail.
  17. */
  18. extern CONFIG cfg;
  19. extern logBuffer logTmp, logBuf;
  20. extern LogTable  *logTab;
  21. extern char onConsole, remoteSysop;
  22. /*
  23. * findPerson()
  24. *
  25. * This function loads a log record for named person.
  26. * RETURNS: ERROR if not found, else log record #
  27. */
  28. int findPerson(char *name, logBuffer *lBuf)
  29.   {
  30.   int  h, i, foundIt, logNo;
  31.   if (strLen(name) == 0) return ERROR;
  32.   if (strCmpU(name, "Citadel") != SAMESTRING)
  33.     {
  34.     h   = hash(name);
  35.     for (foundIt = i = 0;  i < cfg.MAXLOGTAB && !foundIt;  i++)
  36.       {
  37.       if (logTab[i].ltnmhash == h)
  38.         {
  39.         getLog(lBuf, logNo = logTab[i].ltlogSlot);
  40.         if (lBuf->lbflags.L_INUSE &&
  41.         strCmpU(name, lBuf->lbname) == SAMESTRING)
  42.           {
  43.           foundIt = TRUE;
  44.  
  45.           }
  46.  
  47.         }
  48.  
  49.       }
  50.  
  51.     }
  52.   else foundIt = FALSE;
  53.   if (!foundIt)    return ERROR;
  54.   else             return logNo;
  55.  
  56.   }
  57. /*
  58. * PersonExists()
  59. *
  60. * This function will check to see if the given name is valid for mail.
  61. *
  62. * This includes special processing for "Sysop" and "Citadel".
  63. */
  64. int PersonExists(char *name)
  65.   {
  66.   int result;
  67.   if ((strCmpU("Citadel", name) == SAMESTRING && HalfSysop()) ||
  68.   strCmpU("sysop", name) == SAMESTRING)
  69.   return (int)cfg.MAXLOGTAB;       /* signals special string */
  70.   result = findPerson(name, &logTmp);
  71.   if (result != ERROR) strCpy(name, logTmp.lbname);
  72.   return result;
  73.  
  74.   }
  75.